<template>
	<view class="flex justify-center align-center" style="width: 100%;height: 100%;">
		<button @click="goBinding">绑定</button>
	</view>
</template>

<script>
	const app = getApp();
	import {
		GetUrlLink,RedisAdd
	} from '@/api/global.js'
	export default {
		components: {},
		data() {
			return {
				phone:'',
				timer: 0,
				intervalId: null,
			}
		},
		onLoad(options) {
			// options.phone
			this.phone = options.phone
			this.RedisAdd()
		},
		methods: {
			// 定时器60秒后提示二维码失效
			startCountDown() {
				this.intervalId = setInterval(() => {
					 this.timer += 1;
					 if (this.timer == 60) {
						uni.showToast({
						    title: '二维码失效',
						    duration: 2000,
							icon: 'error'
						});
					 }
					 if (this.timer >= 60) {
					   clearInterval(this.intervalId);
					 }
				   }, 1000);
			},
			goBinding(phone) {
				
			},
			// 拿到phone添加到RedisAdd
			async RedisAdd() {
				var res = await RedisAdd({
					Key: this.phone,
					Main: app.globalData.Open_ID,
					Expire:60,
				})
				console.log(res)
			},
		}
	}
</script>

<style>
</style>